Previous Thread
Next Thread
Print Thread
Rate Thread
#259343 09/24/2003 12:55 PM
Joined: Sep 2003
Posts: 7
Lurker
Lurker
Offline
Joined: Sep 2003
Posts: 7
Hello all,

I have a pressing problem that I hope some of you can help with. I'm integrating threads version 6.3.2 into an existing community, with an existing login function. What I need to do is figure out what I need to do to my current login function to automatically login users to the forum. It used to be simple: http://community.infopop.net/2/OpenTopic?a=tpc&s=729094322&f=5163077913&m=3963035063

However, this doesn't work now, and the response I got back from support was that "It's a bit more involved now since it requires generating a session key, storing it in the UBB.threads database and then creating a cookie." They then pointed me here for help. I have full control over my server and the code, so any modifications aren't a problem, I just need to know how to do it. Anyone have any ideas or thoughts?

I'm trying to get this finished in the next couple days, so any help would be greatly appreciated. Thanks!

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
I am sure there are plenty of Developer's in our Developer's for Hire forum that could help you with this.

Two that come off the top of my head that could do this easily are DaveL and JoshPet.

I just just recently coworking on a site had someone deal with integrating software and using Threads Login. Your situation is just the reverse. However the point I am making is something like this is usually not done in days. It does require time to look at the existing functions and then the code you will be replacing it with and making things mesh.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah, this is probably tricky.

First thing - you need your existing users to be input into the threads database - they would have to have a user entry in the w3t_Users table. That's why doing the reverse and using threads for the registration system is much easier.

So you'd need to copy your existing users to the Threads database and modify your existing new user function to also add users to the Threads database.

Passwords need to be stored MD5 encoded in the w3t_Users database, and some other key fields need to be setup U_Approved = 'yes' etc.... You can check the INSERT function inside the adduser.php for exactly what the minimum info is needed to insert the user.

Then indeed, you'd need to replicate the cookies that are set when you login to threads. You can see this in the ubbt.inc.php in the function "do_login".

If your existing pages handling this are php and using MySQL it would be easier to replicate what the login function does, and even perhaps include the main.inc.php file so that your pages have access to the threads variables etc...

Assuming you're using cookies.... I'm not exactly sure how it would need to be handled in Sessions.

I've never done anything myself this way, I've done it the way omegatron suggests, getting other PHP pages etc.. to work off the Threads user base.

I would presume it's more complicated if your existing pages are not PHP pages. I'm not sure, as I'm not proficient in other languages.

Joined: Sep 2003
Posts: 7
Lurker
Lurker
Offline
Joined: Sep 2003
Posts: 7
Thanks for the help guys, I'll try it out tonight and see where I get. Otherwise, I'll probably be contacting you, Josh, or Dave for developer for hire help.

And sorry about posting this in a couple different areas, I didn't know where was best to post it, and I wasn't getting responses initially. My bad.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
No problemo - just tidying up so that all the responses get focused in one place so it's easier for those trying to offer advice.

Sponsored Links
Joined: Sep 2003
Posts: 7
Lurker
Lurker
Offline
Joined: Sep 2003
Posts: 7
Josh, you're the man! I haven't gotten to importing my existing users or configuring the community registration process to populate the UBB.t DB yet, but I did bring over a couple sample users and tweaked my login script based on the info you provided above, Josh. Worked like a charm, got the correct cookies in with the correct info and viola, the user is automatically logged in.

For anyone also trying to do this, here is what I pulled out of ubbt.inc.php as Josh suggested and added to my login script (and yes, it is PHP) to set the cookies correctly. This chunk goes after the user is authenticated:

srand((double)microtime()*1000000);
$newsessionid = md5(rand(0,32767));
$autolog = md5("$Uid$pass");
setcookie("w3t_myid","$Uid",time()+31536000,"/");
setcookie("w3t_key","$autolog",time()+31536000,"/");
setcookie("w3t_mysess","$newsessionid","0","/");
setcookie("w3t_language","english",time()+31536000,"/");
setcookie("ubbt_pass","",time()-3600,"/");
setcookie("ubbt_dob","",time()-3600,"/");

You basically have to make sure the Uid matches up with your existing User ID scheme, and make sure $pass is already an md5 encrypted version of the user's password. You'll notice I had to hardcode some of the cookie variables (such as the language and the path), but nothing too crazy here, and it works great.

I'll try to update this as I drop in my existing users and tweak my current registration process to do the DB insert into the UBB.t DB, but it should be relatively easy. The existing users dump should be a simple script looping an insert, and the registration process tweak should also just be a variation of the insert query that Josh pointed me to.

Thanks again.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Shock Hosting
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Nettomo
Nettomo
Germany, Bremen
Posts: 417
Joined: November 2001
Forum Statistics
Forums63
Topics37,583
Posts293,955
Members13,824
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 1424
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 26
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260108)